fix: resolve framework version from an isolated framework venv - #1225
Conversation
`detect_stack_fingerprint` resolves versions with `importlib.metadata`, which only sees the interpreter running the orchestrator. `--framework-env isolated` is the default for vLLM -- its ROCm wheel pins its own torch, so it must not share that environment -- which means the framework is installed where this lookup cannot reach it. Every bare-metal vLLM run therefore recorded the framework it actually served with as `vllm unknown`. Fall back to the venv root setup already records in `.env` (`VLLM_VENV_ROOT`) and read the distribution metadata from its site-packages. Env pins keep priority and the scan stays behind `probe=True`, so the hermetic contract of `probe=False` is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
CI E2E report — ❌ Timeout
|
…uilder The previous commit fixed `detect_stack_fingerprint`, which the run report reads, but not the session manifest -- and the manifest is the copy that reaches the KB row, the specialist prompt and resume. `build_manifest` already called `build_provenance()`, whose result carries a `stack_fingerprint`, and then discarded that key in favour of a second, local `_detect_stack_fingerprint()` that resolves versions by importing the package. Under `--framework-env isolated` -- the default for vLLM -- that import cannot succeed, so the manifest recorded `vllm unknown`. Downstream `cli/kb.py` copies only non-`unknown` values into `stack_fingerprint_meta` and `phases/explore.py` fills the specialist `framework_version` from that, so the fingerprint stayed empty in all three consumers. Take the field from the shared builder and delete the local detector, along with the `_read_first_line` helper and `_STACK_FINGERPRINT_ENVS` table that only it used. The shared implementation is the one the module docstring in `common/provenance.py` already named as the intended single source, and it resolves versions through `importlib.metadata` rather than importing vLLM into the orchestrator on the session-start path. One behaviour change beyond the bug: `aiter` was read from the imported module's `__commit__` and now comes from distribution metadata, so it records a version rather than a commit sha when aiter happens to be installed in the orchestrator's own interpreter. `AITER_COMMIT` still takes priority, which is how that sha is normally supplied. Co-authored-by: Cursor <cursoragent@cursor.com>
|
You're right, and thanks — I traced the whole chain and it holds exactly as you described.
The downstream consequence is the one you named: Worth adding: What the follow-up commit doesTakes the first of your two options.
One behaviour change to flagThe two detectors were not equivalent beyond the venv fallback. The manifest's version read TestsAdded Removed the five tests that covered the deleted helpers, and the six Green locally: 65 in the three directly-touched files, plus 360 across the manifest/session/KB |
|
Following up on the Correction first: I wrote that Why keep the shared implementation anyway:
The follow-up I'd suggest, separately: have setup record |
…-venv fix: resolve framework version from an isolated framework venv
Problem
detect_stack_fingerprintresolves versions withimportlib.metadata, which only sees theinterpreter running the orchestrator.
--framework-env isolatedis the default for vLLM —its ROCm wheel pins its own torch, so it must not share that environment — which means the
framework is installed where this lookup cannot reach it. Every bare-metal vLLM run therefore
recorded the framework it actually served with as unknown:
The session manifest degraded the same way for a second, independent reason:
build_manifestalready called
build_provenance(), but discarded itsstack_fingerprintand used a local_detect_stack_fingerprint()that resolves versions by importing the package — an import thatcannot succeed under an isolated venv. Since
cli/kb.pycopies only non-unknownvalues intostack_fingerprint_meta, andphases/explore.pyfills the specialistframework_versionfromthat map, the fingerprint was missing from the KB row, the specialist prompt and resume — not
just from the report.
Approach
When the running interpreter has no such distribution, fall back to the venv root that setup
already records in
.env(VLLM_VENV_ROOT) and read the distribution metadata from itssite-packages. Operator pins (VLLM_VERSION) keep priority, and the scan stays behindprobe=Trueso the hermetic contract thatprobe=Falsedocuments is unchanged.Then source the manifest's
stack_fingerprintfrom the shared builder and delete the localdetector, together with the
_read_first_linehelper and_STACK_FINGERPRINT_ENVStable thatonly it used.
common/provenance.py's module docstring already named the shared implementationas the intended single source; that note is updated now that the duplication is gone.
Behaviour change
Unifying the two detectors changes one field beyond the bug:
aiterwas read from the importedmodule's
__commit__and now comes from distribution metadata, so it records a version ratherthan a commit sha when aiter is installed in the orchestrator's own interpreter.
AITER_COMMITstill takes priority, which is how that sha is normally supplied.
Test coverage
Four cases in
test_common_provenance.py: a framework in its own venv is still versioned, anoperator pin still wins over the venv, a venv root that is not there is not a failure, and
probe=Falsedoes not touch the filesystem.One case in
test_manifest_unit.pycovering the manifest itself: with onlyVLLM_VENV_ROOTsetand no vllm in the running interpreter, the written manifest carries the version rather than
unknown. Five tests covering the deleted helpers were removed, as were six monkeypatch seamsthat patched a name that no longer exists.
Verified on a bare-metal vLLM host:
vllmresolves to0.27.1+rocm723where it previouslyread
unknown.